package com.example.service;

import com.example.entity.Outbound;
import com.example.mapper.OutboundMapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OutboundService {

    @Resource
    OutboundMapper outboundMapper;

    public void add(Outbound outbound) {
        outboundMapper.insert(outbound);
    }

    public void deleteById(Integer id) {
        outboundMapper.deleteById(id);
    }

    public void updateById(Outbound outbound) {
        outboundMapper.updateById(outbound);
    }

    public List<Outbound> selectAll() {
        return outboundMapper.selectAll();
    }

    public Outbound selectById(Integer id) {
        return outboundMapper.selectById(id);
    }

    public PageInfo<Outbound> selectPage(Integer pageNum, Integer pageSize) {
        //开启分页查询
        PageHelper.startPage(pageNum, pageSize);
        List<Outbound> list = outboundMapper.selectAll();
        return PageInfo.of(list);
    }
}
